/* 
 * Copyright 2011 kOSMik.
 * This file is part of kOSMik.
 * 
 * kOSMik is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * kOSMik is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with kOSMik.  If not, see <http://www.gnu.org/licenses/>.
 *  
 * kOSMik:
 * Open Street Map - Editor.
 * http://code.google.com/p/swp-dv-ws2010-osm-2/
 */

package de.fuberlin.kosmik.export;

/**
 * Static methods for conversion of various formats. Necessary for GPX/OSM
 * export.
 */
final class TypeConverter {

	private TypeConverter() {
		// utility class
	}

	private static final String TIMEPATTERN = "yyyy-MM-dd'T'HH:mm:ss'Z'";

	/**
	 * Convert a posix timestamp in millisecond resolution to a date string
	 * according to ISO 8601 format.
	 * 
	 * @param timestamp in ms resolution.
	 * @return String in ISO 8601 representing the given posix timestamp.
	 */
	public static String convertTime(long timestamp) {
		return new java.text.SimpleDateFormat(TIMEPATTERN)
				.format(new java.util.Date(timestamp));
	}
}
